/**
 * @param {number[]} nums
 * @param {number[][]} operations
 * @return {number[]}
 */
 var arrayChange = function(nums, operations) {
  const mp = new Map()
  for(let i = 0; i<nums.length; i++) {
    mp.set(nums[i], i)
  }
  for(let i = 0; i<operations.length; i++) {
    const [x, y] = operations[i]
    const idx = mp.get(x)
    mp.delete(x)
    nums[idx] = y
    mp.set(y, idx)
  }
  return nums
};